﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace HospitalCaseScan
{
    public partial class frmMain : Form
    {
        public frmMain()
        {
            InitializeComponent();
            BindGVSummary();
            toolStripComboBox1.SelectedIndex = 0;
        }

        public void BindGVSummary()
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("序号");
            dt.Columns.Add("病案编号");
            dt.Columns.Add("借出时间");
            dt.Columns.Add("归还时间");
            dt.Columns.Add("经办人");
            dt.Columns.Add("借阅，归还人");
            dt.Columns.Add("状态");

            dt.Rows.Add("1", "00123001", "2012-07-01", "无", "质量科A", "医生B", "未归还");
            dt.Rows.Add("2", "00123003", "2012-07-04", "无", "质量科C", "医生B", "未归还");
            dt.Rows.Add("3", "00123003", "2012-07-04", "无", "质量科C", "医生D", "未归还");
            dt.Rows.Add("4", "00333003", "2012-06-25", "2012-07-02", "质量科A", "医生A", "已归还");
            dt.Rows.Add("5", "00333004", "2012-06-15", "2012-06-25", "质量科A", "医生A", "已归还");
            dt.Rows.Add("6", "00333004", "2012-06-15", "2012-06-25", "质量科A", "医生A", "已归还");
            dt.Rows.Add("7", "00333004", "2012-06-15", "2012-06-25", "质量科A", "医生A", "已归还");

            GVSummary.DataSource = dt;
            
        }

        private void toolStripbtnCheckOut_Click(object sender, EventArgs e)
        {
            new frmCheckOut("CheckOut").ShowDialog();
        } 
       
        private void toolStripbtnCheckIn_Click(object sender, EventArgs e)
        {
            new frmCheckOut("CheckIn").ShowDialog();
        }

        private void toolStripbtnSearch_Click(object sender, EventArgs e)
        {
            GVSummary.DataSource = null;
            DataTable dt = new DataTable();
            dt.Columns.Add("序号");
            dt.Columns.Add("病案编号");
            dt.Columns.Add("借出时间");
            dt.Columns.Add("归还时间");
            dt.Columns.Add("经办人");
            dt.Columns.Add("借阅，归还人");
            dt.Columns.Add("状态");

            dt.Rows.Add("1", toolStriptxtSearchField.Text, "2012-06-15", "2012-06-25", "质量科A", "医生A", "已归还");

            GVSummary.DataSource = dt;
        }

        private void CheckOutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            new frmCheckOut("CheckOut").ShowDialog(); 
        }

        private void CheckInToolStripMenuItem_Click(object sender, EventArgs e)
        {
            new frmCheckOut("CheckIn").ShowDialog();  
        }

        private void CaseHistoryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            new frmCaseHistory().ShowDialog();
        }

        private void toolStripButton4_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("确定注销吗？", "确定注销吗？", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                this.Close();
                new frmLogin().Show();
            }

        }

        private void toolStripButton5_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("确定退出系统吗？", "确定退出系统吗？", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                Application.Exit();
            }
        }

        private void VersionInformToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MessageBox.Show("当前版本：Demo V20120707 ");
        }

        private void UserManageToolStripMenuItem_Click(object sender, EventArgs e)
        {
            new frmUserManagement().ShowDialog();
        }

        private void RptByClassToolStripMenuItem_Click(object sender, EventArgs e)
        {
            new frmRptByClass().ShowDialog();
        }

        private void RptByDoctorToolStripMenuItem_Click(object sender, EventArgs e)
        {
            new frmRptByDoctor().ShowDialog();
        }

    }
}
